<?php
/**
 * Created by PhpStorm.
 * User: tengwei
 * Date: 2018/11/16
 * Time: 10:33 AM
 */

namespace app\controllers;

use common\widgets\Tool;
use yii\web\Controller;
use Yii;

class BankController extends BaseController
{

    /** @var \common\logics\bank\BankLogic $BankService */
    private $BankService;


    public function init()
    {
        $this->BankService = Yii::$container->get('BankService');
        parent::init();
    }

    //体现信息绑定
    public function actionBandeBank(){
        $param = [
            'buy_id' => Yii::$app->request->post('buy_id',0),         //买手用id
            'real_name' => Yii::$app->request->post('real_name',''),    //真实姓名
            'cardnum' => Yii::$app->request->post('cardnum',''),        //卡号
            'bankname' => Yii::$app->request->post('bankname',''),     //开户行
            'pro_name' => Yii::$app->request->post('pro_name',''),      //开户省
            'pro_code' => Yii::$app->request->post('pro_code',''),      //开户身代号
            'city_name' => Yii::$app->request->post('city_name',''),    //开户市
            'city_code' => Yii::$app->request->post('city_code',''),    //开户市代号
            'bankbranch'  => Yii::$app->request->post('bankbranch',''), //开户行支行
            'idcard' => Yii::$app->request->post('idcard',''),          //身份证号
            'bankphone' => Yii::$app->request->post('bankphone',''),    //开户行手机
            'verifycode' => Yii::$app->request->post('verifycode',''),  //开户行短信验证码
            'id_positive_url' => Yii::$app->request->post("id_positive_url",""),   //身份证正面
            'id_verso_url' => Yii::$app->request->post("id_verso_url",""),          //身份证反面
        ];
        $result = $this->BankService->addBdBank($param);
        return  $result;
    }
    //获取提现信息
    public function actionGetBankList()
    {
        $param = [
            'buy_id' => Yii::$app->request->post('buy_id',0),         //买手用id
        ];

        $result = $this->BankService->getReflectList($param);
        return $result;
    }

    public function actionGetBankDetail()
    {
        $param = [
            'buy_id' => Yii::$app->request->post('buy_id','0'),         //买手用id
            "safetyCode" => Yii::$app->request->post("safetyCode",'0'),             //安全码
        ];
        $result = $this->BankService->getBankDetail($param);
        return $result;
    }

    public function actionModifyBank()
    {
        $param = [
            "buy_id" => Yii::$app->request->post("buy_id",0),           //买号id
            'b_id' => Yii::$app->request->post('b_id',0),               //提现绑定id
            'real_name' => Yii::$app->request->post('real_name',''),    //真实姓名
            'cardnum' => Yii::$app->request->post('cardnum',''),        //卡号
            'bankname' => Yii::$app->request->post('bankname',''),     //开户行
            'pro_name' => Yii::$app->request->post('pro_name',''),      //开户省
            'pro_code' => Yii::$app->request->post('pro_code',''),      //开户身代号
            'city_name' => Yii::$app->request->post('city_name',''),    //开户市
            'city_code' => Yii::$app->request->post('city_code',''),    //开户市代号
            'bankbranch'  => Yii::$app->request->post('bankbranch',''), //开户行支行
            'idcard' => Yii::$app->request->post('idcard',''),          //身份证号
            'bankphone' => Yii::$app->request->post('bankphone',''),    //开户行手机
            'verifycode' => Yii::$app->request->post('verifycode',''),      //开户行短信验证码
        ];
        $result = $this->BankService->modifyBank($param);
        return $result;
    }


}
